package com.zcr.controller;

import com.zcr.pojo.Store;
import com.zcr.service.StoreService;
import com.zcr.vo.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @version 1.0
 * @author： 张诚
 * @date： 2021-03-27 15:48
 */
@Controller
@RequestMapping("/kucunyujing")
public class KucunyujingConntroller {
    
    @Resource
    private StoreService storeService;

    @GetMapping("index")
    public String index(){
        return "kucunyujing";
    }

    @ResponseBody()
    @GetMapping("list")
    public Result list(@RequestParam(defaultValue = "5") Integer count){
        try {
            List<Store> list =storeService.kucunyujinglist(count);
            return Result.sucess(list);
        } catch (NumberFormatException e) {
            e.printStackTrace();
            return Result.success("查询失败");
        }
    }
    
}
